# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CertificateManager.V1.Model.CertificateIssuanceConfig do
  @moduledoc """
  CertificateIssuanceConfig specifies how to issue and manage a certificate.

  ## Attributes

  *   `certificateAuthorityConfig` (*type:* `GoogleApi.CertificateManager.V1.Model.CertificateAuthorityConfig.t`, *default:* `nil`) - Required. The CA that issues the workload certificate. It includes the CA address, type, authentication to CA service, etc.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The creation timestamp of a CertificateIssuanceConfig.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. One or more paragraphs of text description of a CertificateIssuanceConfig.
  *   `keyAlgorithm` (*type:* `String.t`, *default:* `nil`) - Required. The key algorithm to use when generating the private key.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Optional. Set of labels associated with a CertificateIssuanceConfig.
  *   `lifetime` (*type:* `String.t`, *default:* `nil`) - Required. Workload certificate lifetime requested.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Identifier. A user-defined name of the certificate issuance config. CertificateIssuanceConfig names must be unique globally and match pattern `projects/*/locations/*/certificateIssuanceConfigs/*`.
  *   `rotationWindowPercentage` (*type:* `integer()`, *default:* `nil`) - Required. Specifies the percentage of elapsed time of the certificate lifetime to wait before renewing the certificate. Must be a number between 1-99, inclusive.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The last update timestamp of a CertificateIssuanceConfig.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :certificateAuthorityConfig =>
            GoogleApi.CertificateManager.V1.Model.CertificateAuthorityConfig.t() | nil,
          :createTime => DateTime.t() | nil,
          :description => String.t() | nil,
          :keyAlgorithm => String.t() | nil,
          :labels => map() | nil,
          :lifetime => String.t() | nil,
          :name => String.t() | nil,
          :rotationWindowPercentage => integer() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:certificateAuthorityConfig,
    as: GoogleApi.CertificateManager.V1.Model.CertificateAuthorityConfig
  )

  field(:createTime, as: DateTime)
  field(:description)
  field(:keyAlgorithm)
  field(:labels, type: :map)
  field(:lifetime)
  field(:name)
  field(:rotationWindowPercentage)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.CertificateManager.V1.Model.CertificateIssuanceConfig do
  def decode(value, options) do
    GoogleApi.CertificateManager.V1.Model.CertificateIssuanceConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CertificateManager.V1.Model.CertificateIssuanceConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
